import type { RoutesMap } from "./types";

// !!!!! 注意：name要与path相同

// 登录的所有用户都有此页面权限
export const loginRoutesMap: RoutesMap = new Map([
  [
    "home",
    {
      path: "/home",
      component: () => import("views/home/home.vue"),
      name: "Home",
      meta: {
        title: "首页",
      },
    },
  ]
]);

/**
 * @description: 根据后台返回的菜单权限进行匹配
 * key: 需要与权限接口返回值的attributes.perms相同
 * value: path与name，除了/，其他要相同，否则可能跳转异常
 */
export const routesMap: RoutesMap = new Map([
  [
    "test_button",
    {
      path: "/test/button",
      component: () => import("@/views/test/button/test.vue"),
      name: "MyButton",
      meta: {
        title: "测试页面",
      },
    },
  ],
  [
    "test_table",
    {
      path: "/test/table",
      component: () => import("@/views/test/table/my-table.vue"),
      name: "MyTable",
      meta: {
        title: "表格",
      },
    },
  ],
  [
    "custom_test_table",
    {
      path: "/test/customTable",
      component: () => import("@/views/test/table/custom-table.vue"),
      name: "CustomTable",
      meta: {
        title: "vueHooks列表",
      },
    },
  ],
  // 权限管理
  [
    "sys_user",
    {
      path: "/sysUser",
      component: () => import("views/system/user/user.vue"),
      name: "SysUser",
      meta: {
        title: "用户管理",
      },
    },
  ],
  [
    "sys_role",
    {
      path: "/sysRole",
      component: () => import("views/system/role/role.vue"),
      name: "SysRole",
      meta: {
        title: "角色管理",
      },
    },
  ],
]);
